﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminSite.Master" AutoEventWireup="true" 
    CodeBehind="~/Admin/ChooseEditAgent.aspx.cs" Inherits="Agents.Admin.ChooseEditAgent" %>
<asp:Content ID="Header" ContentPlaceHolderID="Header" runat="server">
</asp:Content>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        בחר סוכן
    </h1>            
    <hr />       
    סינון לפי שם: <asp:TextBox ID="txtAgentName" runat="server" />
    <asp:Button ID="btnFilter" runat="server" UseSubmitBehavior="true" Text="סנן"
        OnClick="btnFilter_Click" CssClass="button"/>
   <asp:ScriptManager ID="ScriptManager1" runat="server" />           
   <asp:DataGrid runat="server" ID="DataGridProjects" AutoGenerateColumns="False"
            AllowPaging="True" PageSize="12" PagerStyle-Mode="NumericPages" 
            DataSourceID="SqlDataSource1" BackColor="White" BorderStyle="None" 
            CellPadding="3" GridLines="Both" 
            onpageindexchanged="DataGridProjects_PageIndexChanged" 
            OnItemCommand="DataGridProjects_ItemCommand"
            CssClass="dataGrid" Font-Names="Verdana" BorderColor="#999999" BorderWidth="1px">
            <AlternatingItemStyle BackColor="#DCDCDC" />
        <Columns>
            <asp:BoundColumn DataField="Id" Visible="false" />
            <asp:BoundColumn DataField="Name" HeaderText="שם סוכן" HeaderStyle-Width="80%" ItemStyle-Width="80%" FooterStyle-Width="80%"/>
            <asp:ButtonColumn CommandName="View"  HeaderText="צפיה" Text="צפה" HeaderStyle-Width="10%" ItemStyle-Width="10%" FooterStyle-Width="10%"/>
            <asp:ButtonColumn CommandName="Edit" HeaderText="עריכה" Text="ערוך" HeaderStyle-Width="10%" ItemStyle-Width="10%" FooterStyle-Width="10%"/>
            <asp:TemplateColumn HeaderText="מחיקת סוכן" HeaderStyle-Width="10%" ItemStyle-Width="10%" FooterStyle-Width="10%">
                <ItemTemplate>
                    <asp:LinkButton ID="deleteBtn" Text="מחק" CommandName="Delete" runat="server" />
                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
                                    TargetControlID="deleteBtn" DisplayModalPopupID="modalPopUp" />
                    <asp:Panel ID="popup" runat="server" CssClass="popup">
                        <table>
                            <tr><td colspan="2">האם אתה בטוח שברצונך למחוק את הסוכן?</td></tr>
                            <tr>
                                <td><asp:Button ID="ok" Text="כן" runat="server" CssClass="button" /></td>
                                <td><asp:Button ID="cancel" Text="לא" runat="server" CssClass="button" /></td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <ajaxToolkit:ModalPopupExtender ID="modalPopUp" CancelControlID="cancel" PopupControlID="popup"
                        OkControlID="ok" runat="server" TargetControlID="deleteBtn" />
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
         
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <ItemStyle BackColor="White" ForeColor="Black" />
        <PagerStyle Mode="NumericPages" BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"></PagerStyle>
        <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
    </asp:DataGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
        SelectCommand="SELECT [Id], [Name] FROM [Agents] WHERE ([Type] = @Type) ORDER BY [Name]">
        <SelectParameters>
            <asp:Parameter DefaultValue="Agent" Name="Type" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
            
    <br />           
    <hr />

    <div class="alignCenter">
        <asp:Button ID="backBtn" Text="חזור" runat="server" onclick="backBtn_Click" CssClass="button"/>
    </div>
</asp:Content>
